package com.edoomath.api.dao;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.edoomath.entity.course.wechatgroup.WechatGroup;

/**
 * 
 * @author mohanlan
 *
 */
@Dao(value = "hibernate")
public interface WechatGroupDao {
    
    /**
     * 
     * @param opengid
     * @param courseId
     * @return
     */
    @Query("FROM WechatGroup WHERE opengid = :opengid AND disabled = false AND course.id = :courseId")
    public WechatGroup load(@Variable("opengid") String opengid, @Variable("courseId") Long courseId);
    
    /**
     * 
     * @param id
     * @return
     */
    @Query("FROM WechatGroup WHERE id = :id AND disabled = false")
    public WechatGroup load(@Variable("id") Long id);
    
    /**
     * 
     * @param opengid
     * @return
     */
    @Query("FROM WechatGroup WHERE opengid = :opengid AND disabled = false")
    public WechatGroup load(@Variable("opengid") String opengid);
}
